home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Utilities / PalmLink / src / palmlink.h < prev    next >
C/C++ Source or Header  |  2000-05-05  |  12KB  |  310 lines

  1. /**
  2.  * PalmLink -- Connect 3Com Palm with Amiga
  3.  *
  4.  * Main header
  5.  *
  6.  * (C) 1998-2000 Richard Körber <rkoerber@gmx.de>
  7.  *
  8.  *------------------------------------------------------------------
  9.  *
  10.  * This program is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU General Public License as published by
  12.  * the Free Software Foundation; either version 2 of the License, or
  13.  * any later version.
  14.  *
  15.  * This program is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  * GNU General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU General Public License
  21.  * along with this program; if not, write to the Free Software
  22.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  *
  24.  * You must not use this source code to gain profit of any kind!
  25.  */
  26.  
  27. #ifndef LIBRARIES_PALMLINK_H
  28. #define LIBRARIES_PALMLINK_H
  29.  
  30. #ifndef EXEC_TYPES_H
  31. #include <exec/types.h>
  32. #endif
  33. #ifndef UTILITY_TAGITEM_H
  34. #include <utility/tagitem.h>
  35. #endif
  36.  
  37.  
  38. /*--------------------------------------------------------------**
  39. **    Miscellaneous
  40. */
  41. #define PALMLINK_NAME "palmlink.library"
  42.  
  43.  
  44.  
  45. /*--------------------------------------------------------------**
  46. **    Tags
  47. */
  48. #define PLTAG_BASE          (0x8FEA0000)        /* Base for all TagItems */
  49. #define PLTAG_ErrorPtr      (PLTAG_BASE + 0x00) /* Pointer to LONG for error code result */
  50. #define PLTAG_SerialDevice  (PLTAG_BASE + 0x01) /* Device name */
  51. #define PLTAG_SerialUnit    (PLTAG_BASE + 0x02) /* Device unit nr. */
  52. #define PLTAG_SerialMaxRate (PLTAG_BASE + 0x03) /* Maximum baud rate */
  53. #define PLTAG_SerialTimeout (PLTAG_BASE + 0x04) /* Timeout (seconds) */
  54. #define PLTAG_AbortMask     (PLTAG_BASE + 0x05) /* Signal mask for abortion, e.g. CTRL-C */
  55.  
  56.  
  57. /*--------------------------------------------------------------**
  58. **    Desktop Link Protocol
  59. */
  60. /* System Time */
  61. struct DLP_SysTime
  62. {
  63.   UWORD year;                           /* Year */
  64.   UBYTE month;                          /* Month */
  65.   UBYTE day;                            /* Day */
  66.   UBYTE hour;                           /* Hour */
  67.   UBYTE minute;                         /* Minute */
  68.   UBYTE second;                         /* Second */
  69.   UBYTE pad;                            /* (always set to 0) */
  70. };
  71.  
  72. /* RAM/ROM card info */
  73. struct DLP_StorageInfo
  74. {
  75.   UWORD  cardVersion;                   /* Version */
  76.   struct DLP_SysTime date;              /* Creation date */
  77.   ULONG  ROMSize;                       /* Size of ROM */
  78.   ULONG  RAMSize;                       /* Size of RAM */
  79.   ULONG  RAMFree;                       /* Free RAM */
  80.   char   name[128];                     /* Name of the card */
  81.   char   manuf[128];                    /* Manufacturer of the card */
  82.   UBYTE  cardNo;                        /* Card No. */
  83.   UBYTE  more;                          /* BOOL: more cards? */
  84. };
  85.  
  86. /* System Info */
  87. struct DLP_SysInfo
  88. {
  89.   ULONG romVer;                         /* ROM Version */
  90.   ULONG locale;                         /* Localizion code */
  91.   UBYTE name[128];                      /* System name */
  92. };
  93.  
  94. /* User Info */
  95. struct DLP_UserInfo
  96. {
  97.   ULONG userID;
  98.   ULONG viewerID;
  99.   ULONG lastSyncPC;
  100.   struct DLP_SysTime successfulSync;
  101.   struct DLP_SysTime lastSync;
  102.   char  userName[128];
  103.   char  password[128];
  104. };
  105.  
  106. /* Netsync Info */
  107. struct DLP_NetSyncInfo
  108. {
  109.   UWORD lanSync;
  110.   char hostName[256];
  111.   char hostAddress[40];
  112.   char hostSubnetMask[40];
  113. };
  114.  
  115. /* Database Info */
  116. struct DLP_DBInfo
  117. {
  118.   UBYTE more;                           /* BOOL: more databases? */
  119.   UBYTE excludes;                       /* Exclude flags, see below */
  120.   UWORD flags;                          /* Entry flags, see below */
  121.   ULONG type;                           /* Type ID */
  122.   ULONG creator;                        /* Creator ID */
  123.   UWORD version;                        /* Version */
  124.   ULONG modnum;                         /* Modification Number */
  125.   struct DLP_SysTime createDate;        /* Creation date */
  126.   struct DLP_SysTime modifyDate;        /* Last modification */
  127.   struct DLP_SysTime backupDate;        /* Last backup */
  128.   UWORD index;                          /* Index */
  129.   UBYTE name[34];                       /* Entry name */
  130. };
  131.  
  132. /* GetDBInfo flags */
  133. #define DLPGDBF_RAM           (0x80)    /* List RAM entries only */
  134. #define DLPGDBF_ROM           (0x40)    /* List ROM entries only */
  135.  
  136. /* DBInfo excludes */
  137. #define DLPDBIE_EXCLUDESYNC   (0x80)    /* Exclude from Sync */
  138.  
  139. /* DBInfo flags */
  140. #define DLPDBIF_RESOURCE      (0x0001)  /* DB Resource (not a record) */
  141. #define DLPDBIF_READONLY      (0x0002)  /* Read only */
  142. #define DLPDBIF_APPINFODIRTY  (0x0004)  /* AppInfo has been modified */
  143. #define DLPDBIF_BACKUP        (0x0008)  /* Generic backup */
  144. #define DLPDBIF_NEWER         (0x0010)  /* Newer may replace older in open DB */
  145. #define DLPDBIF_RESET         (0x0020)  /* Reset after installation */
  146. #define DLPDBIF_OPEN          (0x8000)  /* Currently opened */
  147.  
  148. /* DB Attribute */
  149. #define DLPDBAT_DELETED       (0x80)    /* Deleted */
  150. #define DLPDBAT_DIRTY         (0x40)    /* Changed since last sync */
  151. #define DLPDBAT_BUSY          (0x20)    /* Currently locked */
  152. #define DLPDBAT_SECRET        (0x10)    /* Private entry */
  153. #define DLPDBAT_ARCHIVE       (0x08)    /* To be archived on next sync */
  154.  
  155. /* DB Open flags */
  156. #define DLPDBOF_READ          (0x80)    /* Open for reading */
  157. #define DLPDBOF_WRITE         (0x40)    /* Open for writing */
  158. #define DLPDBOF_EXCLUSIVE     (0x20)    /* Do not share */
  159. #define DLPDBOF_SECRET        (0x10)    /* Private entry */
  160. #define DLPDBOF_READWRITE     (0xC0)
  161.  
  162.  
  163.  
  164. /*--------------------------------------------------------------**
  165. **    Connection Management Protocol
  166. */
  167.  
  168. /* CMP structure */
  169. struct PL_CMP
  170. {
  171.   UBYTE  type;                          /* CMP message type */
  172.   UBYTE  flags;                         /* Some flags */
  173.   UWORD  version;                       /* Version code */
  174.   WORD   reserved;                      /* 0 for now */
  175.   ULONG  baudrate;                      /* Wakeup: maximum rate */
  176.                                         /* Init: connection rate */
  177. };
  178.  
  179. /* CMP Types */
  180. #define PLCMP_WAKEUP      (1)           /* Wakeup */
  181. #define PLCMP_INIT        (2)           /* Init connection */
  182. #define PLCMP_ABORT       (3)           /* Abort connection */
  183.  
  184. /* CMP Flags */
  185. #define PLCMPF_CHANGEBAUD (0x80)        /* Init: change baud rate */
  186.  
  187.  
  188.  
  189. /*--------------------------------------------------------------**
  190. **    Packet Assembly Disassembly Protocol
  191. */
  192.  
  193. /* PADP Header structure */
  194. struct PL_PADP_Header
  195. {
  196.   UBYTE  type;                          /* Type of Packet */
  197.   UBYTE  flags;                         /* Flags */
  198.   UWORD  size;                          /* Size of data */
  199. };                                      /* Data follows here */
  200.  
  201. /* PADP Types */
  202. #define PLPADP_DATA       (0x01)        /* Plain Data */
  203. #define PLPADP_WAKE       (0x101)       /* Wakeup, used by CMP */
  204. #define PLPADP_ACK        (0x02)        /* Acknowledge */
  205. #define PLPADP_TICKLE     (0x04)        /* Tickle */
  206. #define PLPADP_ABORT      (0x08)        /* Abort (PalmOS 2.0 only) */
  207.  
  208. /* PADP Flags */
  209. #define PLPADPF_FIRST     (0x80)        /* First packet */
  210. #define PLPADPF_LAST      (0x40)        /* Last packet */
  211. #define PLPADPF_MEMERROR  (0x20)        /* Receiver has not enough memory */
  212.  
  213.  
  214.  
  215. /*--------------------------------------------------------------**
  216. **    Serial Link Protocol
  217. */
  218.  
  219. /* SLP Header structure */
  220. struct PL_SLP_Header
  221. {
  222.   UBYTE  signature[3];                  /* (will be set by palmlink.library) */
  223.   UBYTE  destSocket;                    /* Destination Socket ID */
  224.   UBYTE  srcSocket;                     /* Source Socket ID */
  225.   UBYTE  pckType;                       /* Packet Type */
  226.   UWORD  dataSize;                      /* (will be set by palmlink.library) */
  227.   UBYTE  transID;                       /* Current transaction ID */
  228.   UBYTE  checksum;                      /* (calculated by palmlink.library) */
  229. };
  230.  
  231. /* SLP Socket IDs */
  232. #define PLSLPSOCK_DEBUG (0)             /* Debugger */
  233. #define PLSLPSOCK_CON   (1)             /* Console */
  234. #define PLSLPSOCK_RUI   (2)             /* Remote User Interface */
  235. #define PLSLPSOCK_DLP   (3)             /* Desktop Link Protocol */
  236.  
  237. /* SLP Packet Types */
  238. #define PLSLPTYPE_RDCP  (0)             /* Remote Debugger / Console */
  239. #define PLSLPTYPE_PADP  (2)             /* Packet Assembler Disassembler */
  240. #define PLSLPTYPE_LOOP  (3)             /* Loopback */
  241.  
  242.  
  243. /*--------------------------------------------------------------**
  244. **    Category Application Info
  245. */
  246.  
  247. /* Category AppInfo structure */
  248. struct PL_CategoryAppInfo
  249. {
  250.   UWORD  renamed;                       /* Bit array: renamed categories */
  251.   UBYTE  name[16][16];                  /* Array of Category names */
  252.   UBYTE  ID[16];                        /* Category IDs */
  253.   UBYTE  lastUniqueID;
  254.   UBYTE  pad[3];                        /* always 0 */
  255. };
  256.  
  257.  
  258. /*--------------------------------------------------------------**
  259. **    Error Codes
  260. */
  261.  
  262. /* PalmLink errors */
  263. #define PLERR_OKAY              (0)     /* No error occured */
  264. #define PLERR_NOMEM             (-1)    /* Not enough memory */
  265. #define PLERR_NORESOURCE        (-2)    /* A resource is allocated */
  266. #define PLERR_SERIAL            (-3)    /* Some serial error */
  267. #define PLERR_TIMEOUT           (-4)    /* Connection timeout */
  268. #define PLERR_CHECKSUM          (-5)    /* Data checksum error */
  269. #define PLERR_REMOTENOMEM       (-6)    /* Remote has not enough memory */
  270. #define PLERR_BADPACKET         (-7)    /* Got an unexpected packet */
  271. #define PLERR_NOTCOMPATIBLE     (-8)    /* Connection not compatible */
  272. #define PLERR_BADBAUD           (-9)    /* No fitting Baud rate found */
  273.                                         /* If you should get this one, try */
  274.                                         /* to lower PLTAG_SerialMaxRate. */
  275.                                         /* 9600 should work in any case, */
  276.                                         /* except you have a very wierd */
  277.                                         /* multi serial board. */
  278. #define PLERR_DOSERROR          (-10)   /* DOS error, see IoErr() */
  279. #define PLERR_OS2REQUIRED       (-11)   /* PalmOS2.0 or higher is required */
  280.                                         /* to use this function */
  281. #define PLERR_TOOLARGE          (-12)   /* Data buffer is too large (>64KB) */
  282. #define PLERR_ABORTED           (-13)   /* Aborted by abortion signal */
  283.  
  284. /* DLP errors */
  285. #define PLERR_GENERAL           (1)     /* General system error */
  286. #define PLERR_ILLEGALFCT        (2)     /* Illegal function */
  287. #define PLERR_DLPNOMEM          (3)     /* Out of memory */
  288. #define PLERR_INVPARAM          (4)     /* Invalid parameter */
  289. #define PLERR_NOTFOUND          (5)     /* Not found */
  290. #define PLERR_NONEOPEN          (6)     /* None opened */
  291. #define PLERR_ALREADYOPEN       (7)     /* Already opened */
  292. #define PLERR_TOOMANYOPEN       (8)     /* Too many are opened */
  293. #define PLERR_ALREADYEXIST      (9)     /* Already exists */
  294. #define PLERR_CANTOPEN          (10)    /* Can't open */
  295. #define PLERR_RECDELETED        (11)    /* Record deleted */
  296. #define PLERR_RECBUSY           (12)    /* Record busy */
  297. #define PLERR_UNSUPPORTED       (13)    /* Operation not supported */
  298. #define PLERR_READONLY          (15)    /* Read only */
  299. #define PLERR_NOSPACE           (16)    /* Not enough space */
  300. #define PLERR_EXCEEDED          (17)    /* Limit exceeded */
  301. #define PLERR_CANCELLED         (18)    /* Sync cancelled */
  302. #define PLERR_BADARG            (19)    /* Bad argument wrapper */
  303. #define PLERR_ARGMISSING        (20)    /* Argument is missing */
  304. #define PLERR_ARGSIZE           (21)    /* Bad argument size */
  305.  
  306.  
  307. #endif
  308. /****************************************************************/
  309.  
  310.